/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package post;

/**
 *
 * @author Danny
 */
public class Transaction {

    TransactionHeader header;
    TransactionItem transItems[];
    int numTransItems;
    IPayment payment;
    
    public Transaction(TransactionHeader info){
        transItems = new TransactionItem[100];
        numTransItems = 0;
        header = info;
    }
    
    //
    public TransactionItem getTransactionItemsAt(int index){
        return transItems[index];
    }

    //return number of items in transaction
    public int getNumTransItem(){
        return numTransItems;
    }
    
    //return the type of payment. cash/check/credit
    public IPayment getPayment(){
        return payment;
    }
    
    //set the type of payment. cash/check/credit
    public void setPayment(IPayment pay){
        payment = pay;
    }
    
    //get customer and date/time info
    public TransactionHeader getTransactionHeader(){
        return header;
    }
    
    //add item into transItems[] starting at index zero
    public void addTransactionItem(TransactionItem newItem){
        transItems[numTransItems] = newItem;
        numTransItems++;
    }
}
